<?php
include("accountclass.php");
?>
<form id="frm" >
<div class="ContentTitle">
    <div class="left" style="padding-top:8px"><?php echo $objMenu->MenuName?></div>
    <div class="CMSButton right">
		<a href="?">Về trang chủ</a>
        <?php
		if($objUserType->isAllow($objModule->ModuleID,3)!=-1)
		{
		?>
        	<a href="#" onclick="updateposition()">Cập nhật vị trí</a>
        <?php } ?>
        <?php
		if($objUserType->isAllow($objModule->ModuleID,1)!=-1 )
		{
		?>
		<a href="?module=<?php echo $module?>&action=get&cid=<?php echo $type?>">Thêm</a>
		<?php
		}
		?>
        <?php
        if($objUserType->isAllow($objModule->ModuleID,2)!=-1)
		{
		?>
                <a href="#" onclick="deletelist()">Xóa</a>
		<?php
		}
		?>
    </div>    
    <div class="clear"></div>
</div>
<ul id="ContentTabs" class="shadetabs">
    <!--
    <li><a class="selected" onclick="ShowHideDiv('Tab',1,2)">General Information</a></li>
    <li><a onclick="ShowHideDiv('Tab',1,2)">Account Information</a></li>
    -->
</ul>       

<div id="Tab1" class="TabContainer" style="display:block">
<!-------------CONTENT OF EACH MODULE ---------------------------->
<table width="100%">
	<tr valign="top">
        <td>
        	<table width="100%" class="list">
                <thead>
                  <tr class="thead">
                      <td class="tdright" width="33">
                      <input type="checkbox" onclick="$('input[name*=\'delete\']').attr('checked', this.checked);"/>
                      </td>
                      
                      <td class="tdleft">ID</td>
                      <td class="tdleft">Tên tai khoang</td>
                      <td class="tdleft">Số tin được đăng/tháng</td>
                      <td class="tdleft">Số resum nhận được/tháng</td>
                      <td class="tdleft">Giá</td>
                      <td class="tdleft">Vi trí</td>
                      <td class="tdcenter"></td>
                  </tr>
                </thead>
                <tbody>
			<?php
               
               	$obj = new Account();
				$data = $obj->getTable(" ORDER BY `position` ASC");
                
               	
                foreach($data as $i => $item)
                {
                  	$obj->loadByItem($item);
                    $class="even";
                    if($i%2!=0)
                        $class="odd";
            ?>
                    <tr class="<?php echo $class?>"  >
                        <td class="tdright">
                        <input type="checkbox" name="delete[<?php echo $obj->accountid?>]" value="<?php echo $obj->accountid?>"/>
                        </td>
                        <td class="tdleft"><?php echo $obj->accountid?></td>
                        <td class="tdleft"><?php echo $obj->accountname?></td>
                        <td class="tdleft"><?php echo $obj->jobposting?></td>
                        <td class="tdleft"><?php echo $obj->resumespermonth?></td>
                        <td class="tdleft"><?php echo $obj->price?></td>
                        <td class="tdleft"><input type="text" name="position[<?php echo $obj->accountid?>]" value="<?php echo $obj->position?>" size="5"/></td>
                        <td class="tdcenter">
            <?php
                    if($objUserType->isAllow($objModule->ModuleID,3)!=-1)
                    {
            ?>
                           
                            [<a class="buttonlink" href="?module=<?php echo $module?>&action=get&id=<?php echo $obj->accountid?>">Chỉnh sửa</a>]
            <?php
                    }
            ?>
					
                        </td>
                    </tr>
            <?php
                }
            ?>
                    
                </tbody>
            </table>
        </td>
    </tr>
</table>

<!-------------END CONTENT OF EACH MODULE ---------------------------->
</div>
</form>
<script language="javascript">
function deletelist()
{
	$.post("load.php?path=<?php echo $objModule->ModuleID?>/<?php echo $objModule->ModuleID?>process&func=delete",$("#frm").serialize(),function(data){
		if(data == "true")
			window.location.reload();
		
	})
}

function updateposition()
{
	$.post("load.php?path=<?php echo $objModule->ModuleID?>/<?php echo $objModule->ModuleID?>process&func=updateposition",$("#frm").serialize(),function(data){
		if(data == "true")
			window.location.reload();
		
	})
}
</script>